
<script setup>
import {onMounted, reactive } from 'vue'
import { playlistsAPI } from '../../../../api'
import Comment from './comment.vue'
import { useRoute } from 'vue-router';
const route = useRoute()
console.log(route.params.id);
let a = defineProps({
  paylist:{}
})

const playarr = reactive([])
const getPlay = async () => {
  const {data:res} = await playlistsAPI(route.params.id)
  console.log(res.songs);
  playarr.push(res.songs)
}

onMounted(()=>{
  getPlay()
})

</script>
<template>
  <div class="song">
    <div class="song-top">
      <div class="title-hd">
        <span class="name">歌曲列表</span>
        <span class="songcontent">99首歌</span>
      </div>
      <div class="title-bd">
        <div class="player"><span>生成外链播放器</span></div>
        <div class="plays">播放：<strong>{{a.paylist.playCount}}</strong>次</div>
      </div>
    </div>
    <div class="listta">
      <table class="m-table ">
        <thead>
          <tr>
            <th class="w1"></th>
            <th class="w1 w2"><span>歌曲标题</span></th>
            <th class="w1 w3"><span>时长</span></th>
            <th class="w1 w4"><span>歌手</span></th>
            <th class="w1 w5"><span>专辑</span></th>
          </tr>
        </thead>
        <tbody>
          <template v-for="(item,index) in playarr[0]" :key="index">
          <tr>
            <td class="t1">{{index+1}}</td>
            <td class="t2">{{item.name}}</td>
            <td class="t3">03:{{(index)}}</td>
            <td class="t4">{{item.ar[0].name}}</td>
            <td class="t5">{{item.al.name}}</td>
          </tr>
        </template>
        </tbody>
      </table>
    </div>
  </div>
  <div class="more">
    <div class="more-szie">查看更多内容，请下载客户端</div>
    <div class="more-btn">立即下载</div>
  </div>
 <div>
    <Comment></Comment>
 </div>
</template>
<style lang="less" scoped>
.song-top {
  display: flex;
  justify-content: space-between;
  height: 40px;
  border-bottom: 2px solid #c20c0c;
  .title-hd {
    .name {
      font-size: 20px;
      line-height: 28px;
      color: #333;
    }
    .songcontent {
      font-size: 12px;
      color: #666;
      margin: 9px 0 0 20px;
    }
  }
  .title-bd {
    display: flex;
    margin-top: 7px;
    font-size: 12px;
   .player {
      color: #4996d1;
      span {
        text-decoration: underline;
      }
      &::before{
        display: inline-block;
        content:'';
        width: 16px;
        height: 16px;
        background-position: -34px -863px !important;
        background: url(https://s2.music.126.net/style/web2/img/icon.png?5025a0435ce5d0b150f2395f8d02b3c3) no-repeat 0 9999px;
}
    }
    .plays {
      margin-left: 20px;
      strong {
        color: #c20c0c;
      }
    }
  }
}
.listta {
    width: 100%;
    border: 1px solid #d9d9d9;
  .m-table {
    th {
      vertical-align: top;
      text-align: left;
      font-weight: normal;
      color: #666;
      background: #f6f6f6;
  }
    .w1 {
      width: 75px;
      height: 39px;
      line-height: 39px;
      border-bottom:  1px solid #d9d9d9;
      border-right:  1px solid #d9d9d9;
      span {
        margin-left: 6px;
        font-size: 12px;
      }
    }
    .w2 {
      width: 235px;
    }
    .w3 {
      width: 110px;
    }
    .w4 {
      width: 89px;
    }
    .w5 {
      width: 161px;
      border-right:0;
    }

    tbody {
    tr {
      background: #f7f7f7;
      &:nth-child(2n) {
        background: #ffffff;
      }
      td {
       
        padding: 6px 10px;
        line-height: 18px;
        text-align: left;
        height: 30px;
    }
  
    .t1 {
      width: 75px;
    
    }
    .t2 {
      display: inline-block;
      width: 235px;
      height: 30px;
      //超出一行省略号
      white-space: nowrap; //禁止换行
      overflow: hidden;
      text-overflow: ellipsis; //...

    }
    .t3 {
      width: 110px;
    }
    .t4 {
      width: 89px;
    }
    .t5 {
      display: inline-block;
      width: 161px;
      border-right:0;
      height: 30px;
      //超出一行省略号
      white-space: nowrap; //禁止换行
      overflow: hidden;
      text-overflow: ellipsis; //...
    }
    }
  }
  }
}
.more {
    width: 100%;
    height: 66px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-direction: column;
    margin-top: 30px;
    margin-bottom: -10px;
  
  .more-szie {
    text-align: center;
    font-size: 13px;
    color: #333333;
}
.more-btn {
  text-align: center;
    width: 120px;
    height: 30px;
    background-image: linear-gradient(90deg,#ff5a4c 0%,#ff1d12 100%);
    border-radius: 18px;
    line-height: 30px;
    font-size: 12px;
    color: #ffffff;
    text-align: center;
}
  }
</style>